﻿using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ZFSDomain.Common.UserControls
{
    /// <summary>
    /// MsgBox.xaml 的交互逻辑
    /// </summary>
    public partial class MsgBox : Window
    {
        public MsgBox()
        {
            InitializeComponent();

            Messenger.Default.Register<string>(this, "Save", Save);
            Messenger.Default.Register<string>(this, "Cancel", Cancel);
        }

        /// <summary>
        /// 结果，用户点击确定Result=true;
        /// </summary>
        public bool Result { get; private set; }

        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="empty"></param>
        private void Save(string empty)
        {
            this.Result = true;
            this.Close();
        }

        /// <summary>
        /// 取消
        /// </summary>
        /// <param name="empty"></param>
        private void Cancel(string empty)
        {
            this.Result = false;
            this.Close();
        }
    }
}
